﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using ERP_RORZE_DLL.Product.DAO;
using ERP_RORZE_DLL.Product.database;

namespace ERP_RORZE.Product.Quotation
{
    public partial class frm_QuotationEdit : DevExpress.XtraEditors.XtraForm
    {
        public event EventHandler Reload;
        DataTable dt;
        ClsQuationDAO clsQuationDAO = new ClsQuationDAO();
        QuotationTable b = new QuotationTable();

        public string QuotationID;
        public string Date;
        public string CustomerID;

        public frm_QuotationEdit()
        {
            InitializeComponent();
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnEdit_Click(object sender, EventArgs e)
        {
            b.QuotationID = txtQuotationID.Text;
            b.Date = dateDate.Value;
            b.CustomerID = cbCustumerID.Text;
            clsQuationDAO.UpdateQuotation(b);
            Reload(sender, e);
        }

        private void frm_QuotationEdit_Load(object sender, EventArgs e)
        {
            dt = clsQuationDAO.GetAllCustumerID();
            cbCustumerID.DataSource = dt;
            cbCustumerID.DisplayMember = "CustomerID";
            cbCustumerID.ValueMember = "CustomerID";
            //

            txtQuotationID.Text = QuotationID;
            dateDate.Value = DateTime.Parse(Date);
            cbCustumerID.Text = CustomerID;
        }
    }
}